package com.weishenai.customerassistant.schedule;


import com.weishenai.customerassistant.service.PublishingTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务
 */
@Component
@Slf4j
public class StatisticTask {

    @Autowired
    PublishingTaskService publishingTaskService;

    /**
     * 每日0点 清除已完成的任务
     */
    @Async("executor")
    @Scheduled(cron = "0 0 0 * * ?")
    public void deleteByState(){
        publishingTaskService.deleteByState("已勘测");
    }
}
